package com.yiduo.outpost.core.log.config;

import com.yiduo.outpost.core.log.operation.OperationLogAspect;
import com.yiduo.outpost.core.log.service.OperationLogService;
import com.yiduo.outpost.core.log.service.impl.OperationLogServiceImpl;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
//@ConditionalOnProperty(name = "com.yiduo.outpost.core.log.operation.enabled", havingValue = "true", matchIfMissing = true)
@MapperScan("com.yiduo.outpost.core.log.mapper")
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class OperationLogAutoConfiguration {

    /**
     * 操作日志切面
     */
    @Bean
    public OperationLogService operationLogService() {
        return new OperationLogServiceImpl();
    }

    /**
     * 操作日志切面
     */
    @Bean
    public OperationLogAspect operationLogAspect() {
        return new OperationLogAspect();
    }

}